# -*- coding: utf-8 -*-
import os
import datetime
import logging.config

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LOG_DIR = os.path.join(BASE_DIR, "logs")
if not os.path.exists(LOG_DIR):
    os.makedirs(LOG_DIR)  # 创建路径

LOG_FILE = datetime.datetime.now().strftime("%Y-%m-%d") + ".log"
logging.basicConfig(
    level=logging.DEBUG,
    datefmt='%Y-%m-%d %H:%M:%S',
    format='%(asctime)s - %(name)s - %(levelname)s - %(module)s :%(message)s',
    filename=os.path.join(LOG_DIR, LOG_FILE),
    filemode='a'
)
